#include<bits/stdc++.h>
#define int long long
using namespace std;
const int mod=1e9+7;
int n,m,dp[100005];
signed main(){
	freopen("op.in","r",stdin);
	freopen("op.out","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cin>>n>>m;
	for(int i=0;i<=n;i++) dp[i]=0; dp[n]=1;
	for(int i=n+1;i<=m;i++){
		dp[i]=(dp[i-1]+dp[i/2]*(1-i%2))%mod;
	}
	cout<<dp[m];
	return 0;
}